<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>添加游戏</title>

    <script charset="utf-8" type="text/javascript" src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
    <script charset="utf-8" type="text/javascript" src="/js/com.wxd.js"></script>

    <link rel="stylesheet" type="text/css" href="/style/com.wxd.css"/>

    <style>
        html, body {
            display: block;width: 100%;height: 100%;overflow: hidden;background: rgb(255, 255, 255);
            font-size: 14px;
        }

        html, body, div, input, button {
            margin: 0;border: 0;box-sizing: border-box;
        }

        li {padding-top: 15px;list-style: none;}

    </style>

    <script>
        function add() {
            window.parent.parentLoading();
            let urlQuery = new wxd.Map().loadSearch();
            urlQuery.put("gameName", $("#gameName").val());
            wxd.netty.post("/game/add", urlQuery.toString(),
                function (responseText) {
                    window.parent.parentLoading_close();
                    if (responseText.code !== 1) {
                        window.parent.parentNotice(responseText.msg, true);
                    } else {
                        window.parent.parentAlert("完成");
                    }
                },
                (errorMsg) => {
                    window.parent.parentLoading_close();
                    window.parent.parentAlert("异常：" + errorMsg);
                },
                true,
                120_000
            );
        }
    </script>

</head>
<body>
<div class="btn_box" style="position: absolute;left: 50%;top: 50%;transform: translate(-50%,-50%);width: 380px;text-align: center;padding: 3px;">
    <ul>
        <li><label for="gameName">游戏名字：</label><input type="text" id="gameName" style="width: 260px;"></li>
    </ul>
    <button onclick="add();">提交</button>
</div>
</body>
</html>